﻿<UserControl 
    x:Class="Sidvall.UI.Wpf.Controls.HeaderedXamNumericInput"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:local="clr-namespace:Sidvall.UI.Wpf.Controls"
    xmlns:ig="http://schemas.infragistics.com/xaml" 
    mc:Ignorable="d" 
    d:DesignHeight="100" d:DesignWidth="300">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid x:Name="Label" Grid.Row="0" Visibility="Collapsed"
              Margin="{Binding LabelMargin, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            
            <ContentControl Grid.Column="0"
                            Content="{Binding LabelLeftContent, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                            Focusable="False" />
            <TextBlock Grid.Column="1" TextWrapping="Wrap"
                       Text="{Binding LabelText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}" />
            <ContentControl Grid.Column="2"
                            Content="{Binding LabelRightContent, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                            Focusable="False" />
        </Grid>
        <ig:XamNumericInput Grid.Row="1"
                             InvalidValueBehavior="{Binding NumericInvalidValueBehavior, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}" 
                             IsEnabled="{Binding NumericIsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             IsReadOnly="{Binding NumericIsReadOnly, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             Background="{Binding NumericBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             BorderBrush="{Binding NumericBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}" 
                             BorderThickness="{Binding NumericBorderThickness, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             SpinButtonDisplayMode="{Binding NumericSpinButtonDisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             FontWeight="{Binding NumericFontWeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             Height="{Binding NumericHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             HorizontalAlignment="{Binding NumericHorizontalAlignment, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             Mask="{Binding NumericMask, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             ValueTypeName="{Binding NumericValueTypeName, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             Width="{Binding NumericWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}"
                             Value="{Binding Value, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HeaderedXamNumericInput}}}" />
    </Grid>
</UserControl>
